
#include <machine/asm.h>

ENTRY(strchr)
	movl	4(%sp),%a0		| string
	movb	11(%sp),%d0		| char to look for
ixloop:
	cmpb	(%a0),%d0		| found our char?
	jeq	ixfound			| yes, break out
	tstb	(%a0)+			| null?
	jne	ixloop			| no, keep going
	moveq	#0,%d0			| not found, return null
#ifdef __SVR4_ABI__
	moveal	%d0,%a0
#endif
	rts
ixfound:
	movl	%a0,%d0			| found, return pointer
	rts
END(strchr)

STRONG_ALIAS(index,strchr)
